// src/Expense.java

public class Expense {
    private String date;
    private double amount;
    private String category;
    private String remark;

    // 构造方法
    public Expense(String date, double amount, String category, String remark) {
        if (amount <= 0) {
            throw new IllegalArgumentException("支出金额必须为正数");
        }
        this.date = date;
        this.amount = amount;
        this.category = category;
        this.remark = remark;
    }

    // Getter方法
    public String getDate() {
        return date;
    }

    public double getAmount() {
        return amount;
    }

    public String getCategory() {
        return category;
    }

    public String getRemark() {
        return remark;
    }

    @Override
    public String toString() {
        return "支出: " + amount + " 元, 日期: " + date + ", 类别: " + category + ", 备注: " + remark;
    }
}
